package cn.com.oceansoft.business.tcsb.service;

import cn.com.oceansoft.business.base.entity.Pager;
import cn.com.oceansoft.business.base.entity.Query;
import cn.com.oceansoft.business.mobile.danger.entity.DangerContent;
import cn.com.oceansoft.business.tcsb.entity.TcsbFj;
import cn.com.oceansoft.business.tcsb.entity.TcsbXx;
import cn.com.oceansoft.business.tcsb.persistence.ITcsbXxMapper;
import cn.com.oceansoft.nos.common.util.web.PageUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by lenovo on 2018/12/12.
 */
@Service
public class TcsbXxServiceImpl implements ITcsbXxService {
    @Resource
    private ITcsbXxMapper tcsbXxMapper;
    @Override
    public void saveTcsbXx(TcsbXx tcsbXx) {
        tcsbXxMapper.insetTcsbXx(tcsbXx);
    }

    @Override
    public void insetTcsbFj(TcsbFj tcsbFj) {
        tcsbXxMapper.insetTcsbFj(tcsbFj);
    }

    @Override
    public Pager<TcsbXx> getXxList(Query query) {
        PageHelper.startPage(query.getPageNum(), query.getNumPerPage(), true);
        List<TcsbXx> list=tcsbXxMapper.getXxList(query);
        Page<TcsbXx> page = (Page<TcsbXx>) list;
        return PageUtil.page2pager(page, query);
    }

    @Override
    public List<Map<String, Object>> getPhotoByID(String id) {
        return tcsbXxMapper.getPhotoByID(id);
    }

    @Override
    public TcsbXx getOneXx(String id) {
        return tcsbXxMapper.getOneXx(id);
    }
}
